from django.shortcuts import render
from .models import Book
from django.core.paginator import Paginator, Page
from django.http import HttpResponse
# Create your views here.
def book(request):
    bs = Book.objects.all()
    paginator = Paginator(bs, 10)
    page_num = request.GET.get("page")
    page = paginator.page(page_num)
    return render(request, "main/book.html", context={"page": page})

def middleware(request):
    return HttpResponse("恭喜，请求成功")